package com.example.demo.mapper;

import com.example.demo.pojo.*;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

@Mapper
public interface StudentMapper {
    //保存学生简历信息
    @Insert("insert into student(account, age, sex, major, phone, email, introduction, reward,name) values (#{account}," +
            "#{age},#{sex},#{major},#{phone},#{email},#{introduction},#{reward},#{name})")
    void save(Student student);

    //获取学生简历信息,根据Account
    @Select("select * from student where account = #{account}")
    Student getByAccount(String account);

    //更新学生信息
    @Update("update student set name = #{name}, age = #{age} ,sex = #{sex},major = #{major}" +
            " ,phone = #{phone},email = #{email},introduction = #{introduction},reward = #{reward} where account = #{account}")
    void update(Student student);

    //投递简历
    @Insert("insert into company_student(accountCm, accountStu,whether) values (#{accountCm},#{accountStu},#{whether})")
    void touDi(Company_Student companyStudent);

    //获取已经投递的信息
    @Select("select * from company_student where accountStu = #{accountStu}")
    List<Company_Student> getByStuAccount(String accountStu);

    //查询全部简历数据
    @Select("select * from student")
    List<Student> selectStudentInfo();


    //查找学生是否邀请该学生 yaoqing 根据学生账号 返回公司账号
    @Select("select * from yaoqing where accountStu = #{accountStu}")
    List<YaoQing> getAccountByAccountStu(String accountStu);


}
